package org.example.curriculum_design_6_16.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.example.curriculum_design_6_16.entity.pojo.PaperScoringRule;
import org.example.curriculum_design_6_16.entity.vo.Result;
import org.example.curriculum_design_6_16.service.PaperScoringRuleService;
import org.example.curriculum_design_6_16.mapper.PaperScoringRuleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 郑凯
* @description 针对表【paper_scoring_rule(论文评分规则表)】的数据库操作Service实现
* @createDate 2025-06-23 09:55:28
*/
@Service
public class PaperScoringRuleServiceImpl extends ServiceImpl<PaperScoringRuleMapper, PaperScoringRule>
    implements PaperScoringRuleService{

    @Autowired
    private PaperScoringRuleMapper paperScoringRuleMapper;

    @Override
    public int addPaperScoringRule(PaperScoringRule rule) {
        return paperScoringRuleMapper.insertPaperScoringRule(rule);
    }

    @Override
    public int updatePaperScoringRule(PaperScoringRule rule) {
        return paperScoringRuleMapper.updatePaperScoringRule(rule);
    }

    @Override
    public int deletePaperScoringRule(Integer id) {
        return paperScoringRuleMapper.deletePaperScoringRuleById(id);
    }

    @Override
    public PaperScoringRule getPaperScoringRuleById(Integer id) {
        PaperScoringRule rule = paperScoringRuleMapper.getPaperScoringRuleById(id);
        if (rule == null) throw new RuntimeException("未找到评分规则");
        return rule;
    }

    @Override
    public List<PaperScoringRule> getAllPaperScoringRules() {
        return paperScoringRuleMapper.getAllPaperScoringRules();
    }

    @Override
    public List<String> getAllType() {
        return paperScoringRuleMapper.getAllPaperScoringRuleTypes();
    }
}




